#include "main.h"

uint8_t write_buff[256]={0x00};
uint8_t read_buff[256]={0x00};
OTA_InfoCB OTA_Info;  

uint8_t ret;

int main(void)
{   
    BSP_Init();
    u1_printf(" hello world\r\n");
    for(uint16_t i=0;i<256;i++)
    {
        AT24CXX_WriteOneByte(i,255-i);
        delay_us(10);
    }
    AT24CXX_Read(0x00,read_buff,256);
    delay_ms(1);
    for(uint16_t i=0;i<256;i++)
    {
        u1_printf("%02x\r\n",read_buff[i]);
        delay_ms(1);
    }
    while(1)
    {   

        // //实现了输入和检测
        // if(U1_CB.U_Data_IN!=U1_CB.U_Data_OUT)
        // {   
        //     //这里U_Data_IN和U_Data_OUT都是指针 实际修改的是数组里面指针对的值，所以U_Data_OUT只要去移动就可以拿到每一次U_Data_IN记录的值了
        //     u1_printf("本次接收 %d  bytes data\r\n",(uint16_t)(U1_CB.U_Data_OUT->end - U1_CB.U_Data_OUT->start + 1));
        //     for(int i=0;i<(U1_CB.U_Data_OUT->end - U1_CB.U_Data_OUT->start+1);i++)
        //     {
        //         u1_printf("%02x\r\n",*(U1_CB.U_Data_OUT->start+i));
        //     }
        //     U1_CB.U_Data_OUT++;
        //     if(U1_CB.U_Data_OUT==U1_CB.U_Data_end) //回卷
        //     {
        //         U1_CB.U_Data_OUT=&U1_CB.U1_Rx_Ptr_Buff[0];
        //     }
        // }
    }
}


void BSP_Init()
{
    NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );//4bit 都用来抢占 只调用一次
    LED_Init();
    USART1_Init(115200);
    m24c02_init();
    delay_ms(100);
}
